<?php
function inet_pton($ip)
{
    # ipv4
    if (strpos($ip, '.') !== FALSE) {
        $ip = pack('N',ip2long($ip));
    }
    # ipv6
    elseif (strpos($ip, ':') !== FALSE) {
        $ip = explode(':', $ip);
        $res = str_pad('', (4*(8-count($ip))), '0000', STR_PAD_LEFT);
        foreach ($ip as $seg) {
            $res .= str_pad($seg, 4, '0', STR_PAD_LEFT);
        }
        $ip = pack('H'.strlen($res), $res);
    }
    return $ip;
}
function sql_current_datetime()
{
	return unix_to_mysql( time() );
	
}

function unix_to_mysql($unix)
{
	return date( 'Y-m-d H:i:s', $unix );
}

function sql_datetime_to_date($datetime)
{
	return date( 'd-m-Y', human_to_unix($datetime));
}
?>